package com.bdqn.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bdqn.mapper.UserMapper;
import com.bdqn.pojo.User;
import com.bdqn.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User login(String usrName, String usrPassword) {
        return userMapper.login(usrName,usrPassword);
    }

    @Override
    public Page<User> findPage(String usrName, Long roleId, Page<User> page) {
        return userMapper.selectUserRolePage(usrName,roleId,page);
    }

    @Override
    public User selectUserName(String usrName) {
        return userMapper.selectUserName(usrName);
    }

    @Override
    public int add(User user) {
        return userMapper.add(user);
    }

    @Override
    public User selectId(Long usrId) {
        return userMapper.selectId(usrId);
    }

    @Override
    public int upd(User user) {
        return userMapper.upd(user);
    }

    @Override
    public int del(Long usrId) {
        return userMapper.del(usrId);
    }

    @Override
    public List<User> findUsersByUsrNameAndUsrPassword(String usrName, String usrPassword) {
        return userMapper.findUsersByUsrNameAndUsrPassword(usrName,usrPassword);
    }

    @Override
    public User getUserByUsrName(String usrName) {
        return userMapper.findUserByUsrName(usrName);
    }
}
